#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
	
	pid_t id = fork();
	if(id == 0)
	{
		//子进程
		int cnt = 5;
		while(cnt--)
		{
			printf("子进程pid:%d\n",getpid());
			sleep(1);
		}
	}
	else if(id>0)
	{
		while(1)
		{
			printf("父进程pid:%d\n",getpid());
			sleep(1);
		}
	}
	return 0;
}

